Skip to content

fix(purge): fetch using target member instead of reading the member cache - #1531

Merged
Zabuzard merged 1 commit into
Together-Java:developfrom
notyourhabibti:fix-purge-commands
Nov 19, 2026
Merged

Zabuzard merged 1 commit into
Together-Java:developfrom
notyourhabibti:fix-purge-commands

Conversation

@notyourhabibti

Copy link
Copy Markdown
Contributor

Pull-request

Changes

  • Existing code
  • New feature

Closes Issue: NaN

Description

The /purge-messages-by-user slash command always failed with the error message "That user is not a member of this guild." because it looked the target up via Guild#getMember. This is a cache-only lookup.

Now the slash command takes the member from OptionMapping#getAsMember, which JDA builds from the interaction's resolved payload and therefore works for uncached members at no extra REST cost.

The confirm button has no resolved data, so it fetches via Guild#retrieveMemberById, deferring the edit first so the fetch cannot blow the interaction ack window, and the follow-up edits go through the interaction hook.

@notyourhabibti
notyourhabibti requested a review from a team as a code owner July 26, 2026 19:46
@CLAassistant

CLAassistant commented Jul 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Tais993 Tais993 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as retrieveMemberById checks the cache first, and only retrieves when actually needed this is a slight improvement for cases where the Member, for some reason is not actually cached.

Additionally, InteractionEvent#editMessage can only be ran once, by using the Hook it can run multiple times. While that doesn't happen yet, it could be something that can be changed in the future so this is ig slightly better?

But at the same time, I don't think this was ever an issue as all members are cached, and same for the edit hook, it was never an issue before. But the code is already there, so I don't see any issues with it?

@Zabuzard Zabuzard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, i guess

@Zabuzard
Zabuzard merged commit 5b1c4d1 into Together-Java:develop Nov 19, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants